package com.study.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.study.dao.QuestionMapper;
import com.study.pojo.entity.Question;
import com.study.pojo.resp.ResultMessage;
import com.study.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> implements QuestionService {

    @Autowired
    QuestionMapper questionMapper;

    @Autowired
    RedisTemplate redisTemplate;

    //获取调查问卷
    @Override
    public ResultMessage findAllQuestion() {

        QueryWrapper<Question> queryWrapper = new QueryWrapper<>();
        List<Question> questions = questionMapper.selectList(queryWrapper);
        if (questions!=null&&questions.size()>0){
            return new ResultMessage(1,"ok",questions,null);
        }else{
            return new ResultMessage(0,"fail",null,null);
        }

    }



}
